import collections
class Solution(object):
    def numRabbits(self, answers):
        """
        :type answers: List[int]
        :rtype: int
        """
        c = collections.Counter(answers)
        t = 0
        for key in c:
            t += ((c[key] - 1) // (key + 1) + 1) * (key + 1)
        return t



data = Solution()
answers = [1, 1, 2]
print(data.numRabbits(answers))
